package com.ruoyi.project.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 任务周期截止时间对象 task_cycle_deadlines
 * 
 * @author ruoyi
 * @date 2025-01-27
 */
@Data
public class TaskCycleDeadlines {

    /** 主键ID */
    private Integer id;

    /** 关联的任务ID */
    @Excel(name = "关联的任务ID")
    private Long taskId;

    /** 周期类型（immediate、once、daily、weekly、monthly、custom） */
    @Excel(name = "周期类型", readConverterExp = "immediate=立即,once=一次性,daily=每日,weekly=每周,monthly=每月,custom=自定义")
    private String cycleType;

    /** 周期开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "周期开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date cycleStart;

    /** 周期结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "周期结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date cycleEnd;

    /** 该周期的任务截止时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "该周期的任务截止时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date deadline;

    /** 是否是当前周期（1=是，0=否） */
    @Excel(name = "是否是当前周期", readConverterExp = "1=是,0=否")
    private Integer isCurrent;

    /** 下次触发时间（用于周期性任务） */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "下次触发时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date nextTrigger;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date createdAt;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date updatedAt;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("taskId", getTaskId())
                .append("cycleType", getCycleType())
                .append("cycleStart", getCycleStart())
                .append("cycleEnd", getCycleEnd())
                .append("deadline", getDeadline())
                .append("isCurrent", getIsCurrent())
                .append("nextTrigger", getNextTrigger())
                .append("createdAt", getCreatedAt())
                .append("updatedAt", getUpdatedAt())
                .toString();
    }
}